package com.yqg.protection.listenern;

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.yqg.protection.controller.dto.ImportContingPlanTeamDto;
import com.yqg.protection.entity.ContingPlanTeam;
import com.yqg.protection.mapper.ContingPlanTeamMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * projectName:xf-service1
 * author:zxf
 * time:2024/10/16 10:31
 * description:
 */
@Component
public class ContingPlanTeamListener extends AnalysisEventListener<ImportContingPlanTeamDto> {

    @Autowired
    private ContingPlanTeamMapper contingPlanTeamMapper;

    @Override
    public void invoke(ImportContingPlanTeamDto importContingPlanTeamDto, AnalysisContext analysisContext) {
        ContingPlanTeam contingPlanTeam = new ContingPlanTeam();
        BeanUtil.copyProperties(importContingPlanTeamDto, contingPlanTeam, true);
        contingPlanTeam.setIsDelete(0);
        contingPlanTeamMapper.insert(contingPlanTeam);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
